package com.ledou44.ledourpc.utils;

import com.ledou44.ledourpc.aop.ReferenceAop;
import com.ledou44.ledourpc.client.Client;
import org.springframework.cglib.proxy.Enhancer;

/**
 * @author ledou44
 * 创建代理bean工具类
 */
public class CreateProxyBeanUtil {

    public static Object createReferenceBean(Class<?> cls, Client client) {
        //根据ReferenceAop方法的intercept方法规则，环绕增强，并返回代理对象
        return Enhancer.create(cls, new ReferenceAop(client, cls));
    }

}
